<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>红包信息</title>
<%@ include file="/page/include.jsp"%>
</head>
<link rel="stylesheet" href="${pageContext.request.contextPath}/statics/plugins/bootstrap-daterangepicker/daterangepicker.css" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/statics/css/webform.css?t=20180710" />
<body class="nav-md" style="background-color: #f7f7f7">
    <div class="container body">
        <div class="main_container">
            <div class="framebody" style="min-height: 100%;" role="main">
                <div class="row">
                    <div class="col-md-12 col-sm-12 col-xs-12">
                        <div class="x_panel">
                            <div class="x_content">
                                <form class="form-horizontal form-label-left" novalidate id="couponForm" name="couponForm" method="post">
                                    <input type="hidden" id="id" name="id" value="${coupon.id }">
                                    <div class="item form-group">
                                        <label class="control-label col-md-2 col-sm-2 col-xs-2" for="couponName"><span class="required">*</span>红包名称：
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-6">
                                            <input id="couponName" name="couponName" value="${coupon.couponName }"
                                                class="form-control col-md-3 col-xs-12" type="text" placeholder="请输入红包名称">
                                        </div>
                                    </div>
                                    
                                    
                                    <div class="item form-group">
                                        <label class="control-label col-md-2 col-sm-2 col-xs-2" for="couponAmount"><span class="required">*</span>红包面值：
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-6">
                                            <input id="couponAmount" name="couponAmount" value="${coupon.couponAmount }"
                                                class="form-control col-md-3 col-xs-12" type="text" placeholder="请输入红包面值">
                                        </div>
                                    </div>
                                    
                                    
                                    <div class="item form-group">
                                        <label class="control-label col-md-2 col-sm-2 col-xs-2" for="couponGetDate"><span
                                            class="required"><font color="red">*</font></span>红包活动时间：
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-6">
                                            <input id="couponGetDate" name="couponGetDate" value="${couponGetDate }"
                                                class="form-control col-md-6 col-xs-6" type="text" placeholder="请选择红包领取时间"> 
                                            <input type="hidden" id="beginGetTime" name="beginGetTime" value="<fmt:formatDate value="${coupon.beginGetTime }" type="both" />">
                                            <input type="hidden" id="endGetTime" name="endGetTime" value="<fmt:formatDate value="${coupon.endGetTime }" type="both" />">
                                        </div>
                                    </div>
                                    
                                    
                                    <div class="item form-group">
                                        <label class="control-label col-md-2 col-sm-2 col-xs-2" for="timeType"><span class="required">*</span>红包有效期类型：
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-6">
                                            <c:forEach items="${timeTypeList }" var="type">
                                                <label class="control-label" for="timeType" style="margin-right:50px;">
                                                    <input name="timeType" value="${type.keyValue }" type="radio"
                                                        <c:if test="${coupon.timeType == type.keyValue }"> checked="true" </c:if>
                                                        class="form-control">
                                                    ${type.keyIntro }
                                                </label>
                                            </c:forEach>
                                        </div>
                                    </div>
                                    <c:set var="timeType1Display" value="none"></c:set>
                                    <c:set var="timeType2Display" value="none"></c:set>
                                    <c:choose>
                                        <c:when test="${coupon.timeType == 1 }">
                                            <c:set var="timeType1Display" value="block"></c:set>
                                        </c:when>
                                        <c:when test="${coupon.timeType == 2 }">
                                            <c:set var="timeType2Display" value="block"></c:set>
                                        </c:when>
                                    </c:choose>
                                    <div class="item form-group" id="timeType1" style="display: ${timeType1Display};">
                                        <label class="control-label col-md-2 col-sm-2 col-xs-2" for="couponDate"><span class="required">*</span>红包使用期限：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-6">
                                            <input id="couponDate" name="couponDate" value="${couponDate }"
                                                class="form-control col-md-6 col-xs-6" type="text" placeholder="请选择红包使用期限"> 
                                            <input type="hidden" id="beginTime" name="beginTime" value="<fmt:formatDate value="${coupon.beginTime }" type="both" />">
                                            <input type="hidden" id="endTime" name="endTime" value="<fmt:formatDate value="${coupon.endTime }" type="both" />">
                                        </div>
                                    </div>
                                    <div class="item form-group" id="timeType2" style="display: ${timeType2Display};">
                                        <label class="control-label col-md-2 col-sm-2 col-xs-2" for="limitDay">有效期限天数：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-6">
                                            <input id="limitDay" name="limitDay" value="${coupon.limitDay }" class="form-control col-md-3 col-xs-12"
                                                type="text" placeholder="请输入有效期天数">
                                        </div>
                                    </div>
                                    
                                    
                                    <div class="item form-group">
                                        <label class="control-label col-md-2 col-sm-2 col-xs-2" for="issueNumber"><span class="required">*</span>发放数量：
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-6">
                                            <input id="issueNumber" name="issueNumber" value="${coupon.issueNumber }"
                                                class="form-control col-md-3 col-xs-12" type="text" placeholder="请输入发放数量">
                                        </div>
                                    </div>
                                    
                                    <!-- 01 推送红包  02 -登录红包  -->
                                    <div class="item form-group">
                                    	 <label class="control-label col-md-2 col-sm-2 col-xs-2" for="issueNumber"><span class="required">*</span>红包类型：
                                        </label>
                                        <div class="col-md-9 col-sm-9 col-xs-9">
                                             <c:forEach items="${couponTypeList }" var="type">
                                                <label class="control-label" for="timeType" style="margin-right:50px;">
                                                    <input name="couponType" value="${type.keyValue }" type="radio"
                                                        <c:if test="${coupon.couponType == type.keyValue }"> checked="true" </c:if>
                                                        class="form-control">
                                                    ${type.keyIntro }
                                                </label>
                                            </c:forEach>
                                        </div>
                                    </div>
                                    
                                    
                                    <div class="item form-group">
                                        <label class="control-label col-md-2 col-sm-2 col-xs-2" for="limitNumber"><span class="required">*</span>每人限领（发）数量：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-6">
                                            <input id="limitNumber" name="limitNumber" value="${coupon.limitNumber }"
                                                class="form-control col-md-3 col-xs-12" type="text" placeholder="每人限领（发）张数，不输人表示不限制">
                                        </div>
                                    </div>
                                    
                                    
                                    <div class="item form-group">
                                    	<label class="control-label col-md-2 col-sm-2 col-xs-2" for="issueNumber"><span class="required">*</span>领取对象：
                                        </label>
                                        <div class="col-md-9 col-sm-9 col-xs-9">
                                             <c:forEach items="${getTargetTypeList }" var="target">
                                                <label class="control-label" for="getTargetType" style="margin-right:50px;">
                                                    <input name="getTargetType" value="${target.keyValue }" type="radio"
                                                        <c:if test="${coupon.getTargetType == target.keyValue }"> checked="true" </c:if>
                                                        class="form-control">
                                                    ${target.keyIntro }
                                                </label>
                                            </c:forEach>
                                        </div>
                                    </div>
                                    
                                    <div class="item form-group">
                                    	<label class="control-label col-md-2 col-sm-2 col-xs-2" for="issueNumber">
                                        </label>
                                    	<div class="col-md-6 col-sm-6 col-xs-6 target" id="choseTargetDiv"  style="border: 1px #ddd solid;word-wrap: normal;margin-left:10px;height:302px;padding-top: 10px;overflow-y:auto;">
											<div class="target">
												<dl class="selectedTargetDL" style="border-bottom: none;">
													<dd>
														<ul class="selectedTargetUL"  id="selectedGetTargetList">
															<c:forEach items="${getTargetList }" var="target">
																<li tag="product_category_"+${target.targetVal}>
																	<a href="javascript:void(0)">
																		<b>${target.targetPro }</b><b class="color"></b>
																		<i onclick="removeSelf(this)">×</i>
																	</a>
																</li>
															</c:forEach>
														</ul>
													</dd>
												</dl>
											</div>
										</div>
                                    </div>
                                    
                                    <div class="item form-group">
                                    	<label class="control-label col-md-2 col-sm-2 col-xs-2" for="issueNumber"><span class="required">*</span>使用对象：
                                        </label>
                                        <div class="col-md-9 col-sm-9 col-xs-9">
                                             <c:forEach items="${useTargetTypeList }" var="target">
                                                <label class="control-label" for="useTargetType" style="margin-right:50px;">
                                                    <input name="useTargetType" value="${target.keyValue }" type="radio"
                                                        <c:if test="${coupon.useTargetType == target.keyValue }"> checked="true" </c:if>
                                                        class="form-control">
                                                    ${target.keyIntro }
                                                </label>
                                            </c:forEach>
                                        </div>
                                    </div>
                                    
                                    
                                    <div class="item form-group">
                                    	<label class="control-label col-md-2 col-sm-2 col-xs-2" for="issueNumber">
                                        </label>
                                    	<div class="col-md-6 col-sm-6 col-xs-6 target" id="choseTargetDiv"  style="border: 1px #ddd solid;word-wrap: normal;margin-left:10px;height:302px;padding-top: 10px;overflow-y:auto;">
											<div class="target">
												<dl class="selectedTargetDL" style="border-bottom: none;">
													<dd>
														<ul class="selectedTargetUL" id="selectedUseTargetList">
															<c:forEach items="${useTargetList }" var="target">
																<li tag="product_category_"+${target.targetVal}>
																	<a href="javascript:void(0)">
																		<b>${target.targetPro }</b><b class="color"></b>
																		<i onclick="removeSelf(this)">×</i>
																	</a>
																</li>
															</c:forEach>
														</ul>
													</dd>
												</dl>
											</div>
										</div>
                                    </div>
                                    
                                    
                                    <div class="item form-group">
                                        <label class="control-label col-md-2 col-sm-2 col-xs-2" for="conditionAmount"><span class="required">*</span>满足金额：
                                        </label>
                                        <div class="col-md-6 col-sm-6 col-xs-6">
                                            <input id="conditionAmount" name="conditionAmount" value="${coupon.conditionAmount }"
                                                class="form-control col-md-3 col-xs-12" type="text" placeholder="金额满足X元可以使用红包">
                                        </div>
                                    </div>
                                    
                                    
                                    <div class="item form-group">
                                        <label class="control-label col-md-2 col-sm-2 col-xs-2" for="isLimit">上不封顶：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-6">
                                            <input type="checkbox" name="isLimit" id="isLimit" <c:if test="${coupon.isLimit == 1 }"> checked="true" </c:if> /> <b>上不封顶</b><font color="gray">（如：满100元可使用1张，满200元可使用2张，依次类推）</font>
                                        </div>
                                    </div>
                                    
                                    
                                    <div class="item form-group">
                                        <label class="control-label col-md-2 col-sm-2 col-xs-2" for="isLimit">是否叠加使用：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-6">
                                            <input type="checkbox" name="isComposition" id="isComposition" <c:if test="${coupon.isComposition == 1 }"> checked="true" </c:if> /> <b>叠加使用</b><font color="gray">（是否可以与其他活动叠加使用）</font>
                                        </div>
                                    </div>
                                    
                                    
                                    <div class="item form-group">
                                        <label class="control-label col-md-2 col-sm-2 col-xs-2" for="isLimit">审批附件：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-6">
                                        	<div class="uploadpic_part">
												<ul id="image_container">
													<li>
														<div class="pic1">
															<img src="${rootPath }/statics/images/upload_pic1.png" />
															<input id="upload_user_image" type="file"
																name="imagePath" onchange="ajaxFileUpload(this)" />
														</div>
													</li>
													<c:if test="${coupon.filePath != null}">
														<li>
															<div class="pic1">
																<img src="<%=PublicConfig.IMG_ROOT_URL%>${coupon.filePath}" />
																<a id="btn_close" href="javascript:void(0)" class="icon_close"></a> 
																<input type="hidden" id="filePath" name="filePath" value="${coupon.filePath}" />
															</div>
														</li>
													</c:if>
												</ul>
											</div>
											<span class="pictips">建议尺寸：800*800PX，单张大小不超过1M</span>
                                        </div>
                                    </div>
                                    
                                    
                                    <div class="item form-group">
                                        <label class="control-label col-md-2 col-sm-2 col-xs-2" for="remark">活动规则：</label>
                                        <div class="col-md-6 col-sm-6 col-xs-6">
                                            <textarea id="promotionRule" name="promotionRule" maxlength="500" class="form-control col-md-10 col-xs-12">${coupon.promotionRule }</textarea>
                                        </div>
                                    </div>
                                </form>
                                <div class="ln_solid"></div>
                                <div class="form-btn-content">
                                    <a id="btn_save" class="btn btn-primary">确定</a> 
                                    <a id="btn_back" class="btn btn-default">返回</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript" src="<%=basePath%>/statics/plugins/bootstrap-daterangepicker/moment.min.js"></script>
<script type="text/javascript" src="<%=basePath%>/statics/plugins/bootstrap-daterangepicker/daterangepicker.js"></script>
<script type="text/javascript" src="<%=basePath%>/statics/js/jquery.validate.js"></script>
<script type="text/javascript" src="<%=basePath%>/statics/plugins/upload/ajaxfileupload.js"></script>
<script type="text/javascript" src="<%=basePath%>/js/coupon/coupon_form.js"></script>
</html>